package com.example.prison.config;

import com.example.prison.entity.AreaManagement;
import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Data
public class Response<T> {
    private String status;
    private String message;
    private T data;

    public Response(String status, String message) {
        this.status = status;
        this.message = message;
    }

    public Response(String status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public Response() {
    }

    public static <T> Response<T> success(String message) {
//        log.info(message);
        return new Response<>("success", message);
    }

    public static <T> Response<T> error(String message) {
        //log.error(message);
        return new Response<>("error", message);
    }

    public static <T> Response<T> warn(String message) {
        //log.warn(message);
        return new Response<>("warn", message);
    }

    public static <T> Response<T> info(String message) {
        //log.info(message);
        return new Response<>("info", message);
    }

    public static <T> Response<T> success(String message, T data) {
        //log.info(message,data);
        return new Response<>("success", message, data);
    }

    public static <T> Response<T> info(String message, T data) {
        //log.info(message,data);
        return new Response<>("success", message, data);
    }
}
